n=1808548329
#迭代法
def trailingZeroes(n):
   if n==0:
       return 0
   mul=1
   while n>0:
       mul*=n
       n-=1
   strMul=str(mul)
   strMulRes=strMul[::-1]
   count=0
   for s in strMulRes:
       if s=="0":
           count+=1
       else:
           break
   return count

#朴素递归：和前面的时间复杂度是一样的，所以没什么用
def dg(n):
    if n==1:
        return 1
    return n*dg(n-1)
def trailingZeroes1(n):
    if n==0:
        return 0
    mul=dg(n)
    mulStr=str(mul)
    mulStrRes=mulStr[::-1]
    count=0
    for s in mulStrRes:
        if s=='0':
            count+=1
        else:
            return count


def trailingZeroes2(n):
    if n==0:
        return 0
    count=0
    for i in range(n+1):
        j=i
        while j>0:
            if j%5==0:
                count+=1
                j=int(j/5)
            else:
                break
    return count

def trailingZeroes3(n):
    if n==0:
        return 0
    count=0
    while n>0:
        count+=int(n/5)
        n=int(n/5)
    return count

print(trailingZeroes3(n))

